package com.scoressystem.controller;

import com.scoressystem.utils.Results;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpSession;

@RestController
@RequestMapping("/user")
public class CommomController {
    @RequestMapping("/getnowUser")
    public Results getnowuser(HttpSession session){
      Object nowusername=  session.getAttribute("uname");
      if(nowusername!=null){
          return new Results<>("1","查询成功",nowusername);
      }
      else {
          return new Results<>("0","暂未登录",nowusername);
      }
    }
    @RequestMapping("/loginOut")
    public Results loginOut(HttpSession session){
        session.invalidate();
        return new Results("0","退出成功");
    }
}
